package zw_401_500.zw_455_分发饼干;

import java.util.Arrays;

class Solution {

    public static void main(String[] args) {
        int[] g = {1, 2}, s = {1, 2, 3};
        int n = findContentChildren(g, s);
        System.out.println(n);

    }

    public static int findContentChildren(int[] g, int[] s) {
        Arrays.sort(g);
        Arrays.sort(s);
        int i = 0, j = 0, ans = 0;
        while (i < g.length && j < s.length) {
            if (g[i] <= s[j]) {
                i++;
            }
            j++;
        }
        return i;
    }
}
